package com.hw8.config;

import net.spy.memcached.MemcachedClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.net.InetSocketAddress;

@Configuration
public class MemcacheConfig {
    @Bean
    public MemcachedClient memcachedClient(@Value("${memcache.ip}") String ip, @Value("${memcache.port}")int port) throws Exception{
        MemcachedClient client=new MemcachedClient(new InetSocketAddress(ip,port));
        return client;
    }

}
